home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_qt.idb / usr / freeware / include / qprogressbar.h.z / qprogressbar.h
C/C++ Source or Header  |  2001-04-12  |  4KB  |  133 lines

  1. /****************************************************************************
  2. ** $Id: qt/src/widgets/qprogressbar.h   2.3.0   edited 2001-01-26 $
  3. **
  4. ** Definition of QProgressBar class
  5. **
  6. ** Created : 970520
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QPROGRESSBAR_H
  39. #define QPROGRESSBAR_H
  40.  
  41. #ifndef QT_H
  42. #include "qframe.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_PROGRESSBAR
  46.  
  47.  
  48. class QProgressBarPrivate;
  49.  
  50.  
  51. class Q_EXPORT QProgressBar : public QFrame
  52. {
  53.     Q_OBJECT
  54.     Q_PROPERTY( int totalSteps READ totalSteps WRITE setTotalSteps )
  55.     Q_PROPERTY( int progress READ progress WRITE setProgress )
  56.     Q_PROPERTY( bool centerIndicator READ centerIndicator WRITE setCenterIndicator )
  57.     Q_PROPERTY( bool indicatorFollowsStyle READ indicatorFollowsStyle WRITE setIndicatorFollowsStyle )
  58.     
  59. public:
  60.     QProgressBar( QWidget *parent=0, const char *name=0, WFlags f=0 );
  61.     QProgressBar( int totalSteps, QWidget *parent=0, const char *name=0,
  62.           WFlags f=0 );
  63.  
  64.     int        totalSteps() const;
  65.     int        progress()   const;
  66.  
  67.     QSize    sizeHint() const;
  68.     QSizePolicy sizePolicy() const;
  69.     QSize    minimumSizeHint() const;
  70.  
  71.     void    setCenterIndicator( bool on );
  72.     bool    centerIndicator() const;
  73.  
  74.     void        setIndicatorFollowsStyle( bool );
  75.     bool    indicatorFollowsStyle() const;
  76.  
  77.     void    show();
  78.  
  79. public slots:
  80.     void    reset();
  81.     virtual void setTotalSteps( int totalSteps );
  82.     virtual void setProgress( int progress );
  83.  
  84. protected:
  85.     void    drawContents( QPainter * );
  86.     void    drawContentsMask( QPainter * );
  87.     virtual bool setIndicator( QString & progress_str, int progress,
  88.                    int totalSteps );
  89.     void styleChange( QStyle& );
  90.  
  91. private:
  92.     int        total_steps;
  93.     int        progress_val;
  94.     int        percentage;
  95.     QString    progress_str;
  96.     bool        center_indicator;
  97.     bool        auto_indicator;
  98.     QProgressBarPrivate * d;
  99.     void         initFrame();
  100.  
  101. private:    // Disabled copy constructor and operator=
  102. #if defined(Q_DISABLE_COPY)
  103.     QProgressBar( const QProgressBar & );
  104.     QProgressBar &operator=( const QProgressBar & );
  105. #endif
  106. };
  107.  
  108.  
  109. inline int QProgressBar::totalSteps() const
  110. {
  111.     return total_steps;
  112. }
  113.  
  114. inline int QProgressBar::progress() const
  115. {
  116.     return progress_val;
  117. }
  118.  
  119. inline bool QProgressBar::centerIndicator() const
  120. {
  121.     return center_indicator;
  122. }
  123.  
  124. inline bool QProgressBar::indicatorFollowsStyle() const
  125. {
  126.     return auto_indicator;
  127. }
  128.  
  129.  
  130. #endif // QT_NO_PROGRESSBAR
  131.  
  132. #endif // QPROGRESSBAR_H
  133.